﻿<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Azure Blob Studio 2011" Height="768" Width="1024">
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo/>
    </Window.TaskbarItemInfo>
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="DarkBlue" Offset="0.1"/>
            <GradientStop Color="Blue" Offset="0.4"/>
            <GradientStop Color="LightBlue" Offset="0.6"/>
            <GradientStop Color="DarkBlue" Offset="0.8"/>
            <GradientStop Color="Black" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>

    <Window.Resources>
        <!-- Each image has to be declared inside
             a DrawingImage resource. An identifier
             must be provided via x:Key-->
        <DrawingImage x:Key="ErrorImage">
            <!-- The required image is declared 
                 inside the DrawingImage.Drawing 
                 property definition -->
            <DrawingImage.Drawing>
                <!-- The actual image is specified via an ImageDrawing
                     element. Particularly the ImageSource property
                     points to the image path whereas Rect
                     specifies the image size-->
                <ImageDrawing Rect="0,0,16,16" ImageSource="/AzureBlobStudio;component/Images/109_AllAnnotations_Error_16x16_72.png" />
            </DrawingImage.Drawing>
        </DrawingImage>

        <DrawingImage x:Key="OkImage">
            <DrawingImage.Drawing>
                <ImageDrawing Rect="0,0,16,16" ImageSource="/AzureBlobStudio;component/Images/109_AllAnnotations_Complete_16x16_72.png" />
            </DrawingImage.Drawing>
        </DrawingImage>
    </Window.Resources>


    <Grid>
        <!--Dividing the window into rows-->
        <Grid.RowDefinitions>
            <RowDefinition Height="65"/>
            <RowDefinition Height="40"/>
            <RowDefinition/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>

        <!--The first row: welcome text-->
        <StackPanel Grid.Row="0" Margin="3" Orientation="Horizontal">


            <TextBlock Text="Azure Blob Studio 2011" Margin="5"
                   FontSize="28" Foreground="White" >
            </TextBlock>

            <!--LinkLabel implementation for WPF-->
            <Label Width="200" Height="30">
                <Label.Resources>
                    <Style TargetType="Hyperlink" x:Key="HyperStyle">
                        <Setter Property="Foreground" Value="Azure"/>
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Foreground" Value="Orange"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Label.Resources>

                <Hyperlink NavigateUri="https://mvp.support.microsoft.com/profile/Alessandro.Del%20Sole"
                       Hyperlink.RequestNavigate="Hyperlink_RequestNavigate" Style="{DynamicResource HyperStyle}" >
                    <TextBlock Text="by Alessandro Del Sole" />
                </Hyperlink>
            </Label>
            <!--End of LinkLabel implementation-->
        </StackPanel>

        <!--Account setting controls-->
        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="5" >
            <Label Content="Account:" Margin="5,0,0,0" Foreground="White"/>
            <TextBox Name="AccountText" Margin="5" Width="150"/>

            <Label Content="Shared key:" Margin="5,0,0,0" Foreground="White"/>
            <TextBox Name="KeyText" Margin="5" Width="150" />

            <CheckBox Name="DevAccountCheck" Margin="5" Foreground="White"
                      Content="Use developer account" />

            <Button Name="GoButton" Width="40" Click="GoButton_Click">Go</Button>
        </StackPanel>

        <!--Blob manipulations controls-->
        <StackPanel Grid.Row="3" Orientation="Horizontal" Margin="5">
            <Button Margin="5" Width="110" Height="30" Name="Button1">Create container</Button>
            <Button Margin="5" Width="110" Height="30" Name="RemoveContainerButton">Remove container</Button>
            <Button Margin="5" Width="110" Height="30" Name="RemoveBlobButton">Remove blob(s)</Button>
            <Button Margin="5" Width="110" Height="30" Name="UploadBlobButton">Upload blob(s)</Button>
            <Button Margin="5" Width="110" Height="30" Name="DownloadButton">Download blob(s)</Button>
        </StackPanel>

        <!--Data controls-->
        <Grid Grid.Row="2" Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <!--Will contain the list of containers-->
            <TreeView Grid.Column="0" ItemsSource="{Binding}" Name="ContainersTreeView">
                <TreeViewItem Name="ContainersNode" Header="Containers" />
            </TreeView>

            <!--will show blobs for the selected container-->
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>

                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                 <Label Name="UriLabel" BorderBrush="Gray" BorderThickness="1" Grid.Column="0"/>                   
                    <ProgressBar Name="ProgressBar1" Grid.Column="1"/>
                </Grid>


                <ListView ItemsSource="{Binding}" Name="BlobListView" Grid.Row="0">
                    <ListView.View>
                        <GridView x:Name="BlobGridView">
                            <GridViewColumn Header="Blob name" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Foreground="Black">
                                            <Hyperlink NavigateUri="{Binding Path=Uri}" 
                                                   Hyperlink.RequestNavigate="Hyperlink_RequestNavigate">
                                                <InlineUIContainer>
                                                    <TextBlock Text="{Binding Path=Uri.AbsolutePath}" ToolTip="Click to preview">
                                                    </TextBlock>
                                                </InlineUIContainer>
                                                <Hyperlink.ContextMenu>
                                                    <ContextMenu>
                                                        <MenuItem Header="Copy Uri" Click="MenuItem_Click" />
                                                    </ContextMenu>
                                                </Hyperlink.ContextMenu>
                                            </Hyperlink>
                                        </Label>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            <GridViewColumn Header="Content type">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Properties.ContentType}" Foreground="Black"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Date modified">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Properties.LastModifiedUtc, StringFormat=U}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            <GridViewColumn Header="Unique identifier">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Properties.ETag}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            <GridViewColumn Header="Content Language">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Properties.ContentLanguage}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            <GridViewColumn Header="Content Length">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock>
                                            <TextBlock.Text>
                                                <Binding Path="Properties.Length" 
                                                         StringFormat="{}{0:0,0} Bytes"/>
                                            </TextBlock.Text>
                                        </TextBlock>

                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>

            </Grid>

        </Grid>

    </Grid>
</Window>
